Introduction
This is one of the greatest hacker epics. In a few vivid
images it clarifies more about the ethics and psychology of hackers than a bunch
of volumes of research put together.
Those who know English are advised to read the original, for the rest I made a translation. (Below)
If
you want to understand what a real hacker is, and not gobble up
the pathetic attempts of journalists blackening a bright image, read this, it is for
You.
The Story of Mel, a Real Programmer
This was posted to Usenet by its author, Ed Nather (utastro!nather), on
May 21, 1983.
A recent article devoted to the macho side of programming
made the bald and unvarnished statement:
Real Programmers write in FORTRAN.
Maybe they do now,
in this decadent era of
Lite beer, hand calculators, and "user-friendly" software
but back in the Good Old Days,
when the term "software" sounded funny
and Real Computers were made out of drums and vacuum tubes,
Real Programmers wrote in machine code.
Not FORTRAN. Not RATFOR. Not, even, assembly language.
Machine Code.
Raw, unadorned, inscrutable hexadecimal numbers.
Directly.
Lest a whole new generation of programmers
grow up in ignorance of this glorious past,
I feel duty-bound to describe,
as best I can through the generation gap,
how a Real Programmer wrote code.
I'll call him Mel,
because that was his name.
I first met Mel when I went to work for Royal McBee Computer Corp.,
a now-defunct subsidiary of the typewriter company.
The firm manufactured the LGP-30,
a small, cheap (by the standards of the day)
drum-memory computer,
and had just started to manufacture
the RPC-4000, a much-improved,
bigger, better, faster -- drum-memory computer.
Cores cost too much,
and weren't here to stay, anyway.
(That's why you haven't heard of the company,
or the computer.)
I had been hired to write a FORTRAN compiler
for this new marvel and Mel was my guide to its wonders.
Mel didn't approve of compilers.
"If a program can't rewrite its own code",
he asked, "what good is it?"
Mel had written,
in hexadecimal,
the most popular computer program the company owned.
It ran on the LGP-30
and played blackjack with potential customers
at computer shows.
Its effect was always dramatic.
The LGP-30 booth was packed at every show,
and the IBM salesmen stood around
talking to each other.
Whether or not this actually sold computers
was a question we never discussed.
Mel's job was to re-write
the blackjack program for the RPC-4000.
(Port? What does that mean?)
The new computer had a one-plus-one
addressing scheme,
in which each machine instruction,
in addition to the operation code
and the address of the needed operand,
had a second address that indicated where, on the revolving drum,
the next instruction was located.
In modern parlance,
every single instruction was followed by a GO TO!
Put that in Pascal's pipe and smoke it.
Mel loved the RPC-4000
because he could optimize his code:
that is, locate instructions on the drum
so that just as one finished its job,
the next would be just arriving at the "read head"
and available for immediate execution.
There was a program to do that job,
an "optimizing assembler",
but Mel refused to use it.
"You never know where it's going to put things",
he explained, "so you'd have to use separate constants".
It was a long time before I understood that remark.
Since Mel knew the numerical value
of every operation code,
and assigned his own drum addresses,
every instruction he wrote could also be considered
a numerical constant.
He could pick up an earlier "add" instruction, say,
and multiply by it,
if it had the right numeric value.
His code was not easy for someone else to modify.
I compared Mel's hand-optimized programs
with the same code massaged by the optimizing assembler program,
and Mel's always ran faster.
That was because the "top-down" method of program design
hadn't been invented yet,
and Mel wouldn't have used it anyway.
He wrote the innermost parts of his program loops first,
so they would get first choice
of the optimum address locations on the drum.
The optimizing assembler wasn't smart enough to do it that way.
Mel never wrote time-delay loops, either,
even when the balky Flexowriter
required a delay between output characters to work right.
He just located instructions on the drum
so each successive one was just past the read head
when it was needed;
the drum had to execute another complete revolution
to find the next instruction.
He coined an unforgettable term for this procedure.
Although "optimum" is an absolute term,
like "unique", it became common verbal practice
to make it relative:
"not quite optimum" or "less optimum"
or "not very optimum".
Mel called the maximum time-delay locations
the "most pessimum".
After he finished the blackjack program
and got it to run
("Even the initializer is optimized",
he said proudly),
he got a Change Request from the sales department.
The program used an elegant (optimized)
random number generator
to shuffle the "cards" and deal from the "deck",
and some of the salesmen felt it was too fair,
since sometimes the customers lost.
They wanted Mel to modify the program
so, at the setting of a sense switch on the console,
they could change the odds and let the customer win.
Mel balked.
He felt this was patently dishonest,
which it was,
and that it impinged on his personal integrity as a programmer,
which it did,
so he refused to do it.
The Head Salesman talked to Mel,
as did the Big Boss and, at the boss's urging,
a few Fellow Programmers.
Mel finally gave in and wrote the code,
but he got the test backwards,
and, when the sense switch was turned on,
the program would cheat, winning every time.
Mel was delighted with this,
claiming his subconscious was uncontrollably ethical,
and adamantly refused to fix it.
After Mel had left the company for greener pa$ture$,
the Big Boss asked me to look at the code
and see if I could find the test and reverse it.
Somewhat reluctantly, I agreed to look.
Tracking Mel's code was a real adventure.
I have often felt that programming is an art form,
whose real value can only be appreciated
by another versed in the same arcane art;
there are lovely gems and brilliant coups
hidden from human view and admiration, sometimes forever,
by the very nature of the process.
You can learn a lot about an individual
just by reading through his code,
even in hexadecimal.
Mel was, I think, an unsung genius.
Perhaps my greatest shock came
when I found an innocent loop that had no test in it.
No test. None.
Common sense said it had to be a closed loop,
where the program would circle, forever, endlessly.
Program control passed right through it, however,
and safely out the other side.
It took me two weeks to figure it out.
The RPC-4000 computer had a really modern facility
called an index register.
It allowed the programmer to write a program loop
that used an indexed instruction inside;
each time through,
the number in the index register
was added to the address of that instruction,
so it would refer
to the next datum in a series.
He had only to increment the index register
each time through.
Mel never used it.
Instead, he would pull the instruction into a machine register,
add one to its address,
and store it back.
He would then execute the modified instruction
right from the register.
The loop was written so this additional execution time
was taken into account -
just as this instruction finished,
the next one was right under the drum's read head,
ready to go.
But the loop had no test in it.
The vital clue came when I noticed
the index register bit,
the bit that lay between the address
and the operation code in the instruction word,
was turned on -
yet Mel never used the index register,
leaving it zero all the time.
When the light went on it nearly blinded me.
He had located the data he was working on
near the top of memory -
the largest locations the instructions could address -
so, after the last datum was handled,
incrementing the instruction address
would make it overflow.
The carry would add one to the
operation code, changing it to the next one in the instruction set:
a jump instruction.
Sure enough, the next program instruction was
in address location zero,
and the program went happily on its way.
I haven't kept in touch with Mel,
so I don't know if he ever gave in to the flood of
change that has washed over programming techniques
since those long-gone days.
I like to think he didn't.
In any event,
I was impressed enough that I quit looking for the
offending test,
telling the Big Boss I couldn't find it.
He didn't seem surprised.
When I left the company,
the blackjack program would still cheat
if you turned on the right sense switch,
and I think that's how it should be.
I didn't feel comfortable
hacking up the code of a Real Programmer.
This is one of hackerdom's great heroic epics, free verse or no. In a few spare images it captures more about the esthetics and psychology of hacking than all the scholarly volumes on the subject put together.
[1992 postscript -- the author writes: "The original submission to the net was not in free verse, nor any approximation to it -- it was straight prose style, in non-justified paragraphs. In bouncing around the net it apparently got modified into the `free verse' form now popular. In other words, it got hacked on the net. That seems appropriate, somehow." The author adds that he likes the `free-verse' version better...]
The Story of Mel, a Real Programmer
This was sent to the Net on May 21, 1983 by the author, a man named Ed Nather. Translation, 2002(c) Vladislav Kugelevich
In a recent article about the "cool" side of programming a straight as a log, completely unvarnished thesis was expressed:
Real Programmers write in FORTRAN.
Maybe it is so now,
In this decadent era of
Non-alcoholic beer
Pocket calculators
And friendly interfaces.
But in the good old days,
When the very word "program" sounded funny,
And Real Computers were made on drums and vacuum tubes,
Real programmers wrote in machine code.
Not in Pascal. Not in FORTRAN. And not even in Assembly.
In machine code.
Raw, unadorned, incomprehensible hexadecimal numbers.
Directly.
And so that a new generation of programmers
Does not grow up in ignorance of this great past
I feel the need to describe,
As well as I can
Across the gap between generations,
How a Real Programmer wrote code.
I will call him Mel,
For such was his name.
The first time I met him,
When I came to work at Royal McBee Computer Corp.,
A now deceased subsidiary
Of a typewriter manufacturing company.
The firm manufactured the LGP-30,
A small, cheap (for those times)
Computer on drum memory,
And had just started to manufacture
The RPC-4000, a significantly improved,
Larger, better and faster - computer on drum memory.
Ferrite cores cost too much,
And in any case, their time had passed.
(That is why you have never heard,
Neither of this company, nor of its brainchild)
I was hired to create a FORTRAN compiler
For this amazing device
And Mel was my guide to its secrets.
Mel did not approve of compilers.
"If a program cannot rewrite its own code",
he used to say, - "What is good about it?"
Mel wrote,
In the hexadecimal system,
The most popular program of those,
That the company owned.
It ran on the LGP-30
And played Black-Jack with potential buyers
At computer shows.
The effect was mind-blowing.
The LGP-30 was always busy at all shows,
And IBM salesmen stood around,
Talking to each other.
Did this actually help to sell computers
Is a question we never discussed.
Mel's job was to rewrite
Black-Jack for the RPC-4000
(Porting? What does that mean?)
The new computer had a one-plus-one addressing scheme,
In which each machine instruction
In addition to the operation code
And the address of the working operand
Had a second address, which showed where, on the spinning drum,
The next instruction was located.
Speaking in modern language,
Every single instruction
Was accompanied by a jump command.
Feel that, structured programmers!
Mel loved the RPC-4000
Because he could optimize his code:
That is, to place instructions on the drum so,
That as soon as one finishes its work,
The next one would be just under the "reading head"
And available for immediate execution.
There was a program to do this job,
An "Optimizing assembler",
But Mel refused to use it.
"You never know where it is going to place a command",
He explained, "and you have to use separate constants".
A long time passed before I understood this remark.
Since Mel knew the numerical value
Of each operation's code,
And assigned his own addresses on the drum,
Every instruction written by him,
could also be considered
A numerical constant.
Let's say, he could take the "ADD" instruction,
And multiply by it.
If it had the right numerical value.
It was not easy for others to change his code.
I compared Mel's programs, optimized by hand,
With the code that the optimizing assembler created,
And Mel's programs always worked faster.
This is because the "top-down" programming method had not yet been invented,
And Mel would not have used it anyway.
He wrote the innermost parts of his programs first,
So that they got first choice
In optimal placement addresses on the drum.
The optimizing assembler was not good enough to do it like that.
Mel also never wrote delay loops,
Even when the stubborn Flexowriter
Required a delay between outputted characters
He just placed the instructions on the drum in such a way
That the next one was already past the reading head
When it was required;
And the drum had to make a full revolution
To find the next instruction.
He fostered an unforgettable term for this procedure.
Although "optimal" is an absolute definition,
Just like "unique",
It became commonplace in speech
To make it relative:
"insufficiently optimal", or "less optimal",
or "not very optimal".
Mel called the locations with maximum delay
"The most pessimal".
After he finished writing Black-Jack
And made it work,
("Even the initializer is optimized",
Mel proudly said),
He received a Request For Change from the sales department.
The program used an elegant (optimized)
Random number generator
To shuffle the "cards" and deal from the "deck",
And some Salesmen felt it was too honest,
Since sometimes the buyers lost.
They wanted Mel to fix the program so,
That using a touch switch on the console
They could change the layout, and allow the buyer to win.
Mel was stubborn.
He felt that this was clearly dishonest.
And it was so.
And that this offended his honesty as a programmer
And it was so.
Therefore he refused to do it.
The Head Salesman talked to Mel
So did the Big Boss and, under pressure from the boss,
A few fellow programmers.
Mel finally gave up and wrote the code,
But everything turned out the other way around,
And, when the touch switch was turned on,
The program cheated, winning all the time.
Mel was delighted by this,
Proclaiming his subconscious to be uncontrollably ethical,
And unwaveringly refused to fix it.
After Mel left the company for greener pastures,
The Big Boss asked me to take a look at the code
And see if I could find the test and fix it.
Somewhat reluctantly, I agreed to take a look.
Tracking Mel's code was a true adventure.
I often felt that programming is an art form,
Whose real value can be understood
Only by another initiated into the same mysterious art;
There are lovely jewels and successful moves here
Hidden from human eyes and admiration, sometimes forever
Due to the very nature of the process.
One can learn a lot about a person,
By simply reading his code,
Even a hexadecimal one.
Mel was, I believe, an unsung genius.
Perhaps the greatest shock I received
Was when I found an innocent loop without a condition.
Without any condition. Without.
The first thought was that it must be a closed loop,
Where the program would get stuck forever, endlessly.
However, the program passed through it,
And safely exited on the other side.
It took me two weeks to crack this.
The RPC-4000 computer was equipped with a very modern device
Called the "Index register".
It allowed the programmer to write a loop,
Which used an indexed instruction;
On every pass,
The number in the index register
Was added to the address of this instruction,
So that it pointed
To the next element of the sequence.
One just had to increment
The index register
On every pass.
Mel did not use it.
Instead
He drove the instruction into a machine register
Added one to its address
And saved it back.
Then he executed the modified instruction
Directly from the register.
The loop was written
Taking this extra time into account -
As soon as one instruction finished
The next one was right under the reading head
Ready to launch.
But the loop had no condition.
The crucial clue was when I noticed,
That the index register bit
The bit located between the address
And the operation code
In the instruction word
Was set -
Despite the fact
That Mel never used the index register
Always leaving it equal to zero.
When it dawned on me, I almost went blind.
He placed the data
He was working on
Near the end of memory -
The very last cells that the instructions could address -
And, after processing the last element,
Incrementing the instruction address
Led to its overflow.
The carry added one to the operation code
Turning the instruction into the next one in the instruction set:
A jump instruction.
Of course, the next instruction was located at address zero,
And the program went further on its way.
I did not keep in touch with Mel
And I do not know if he yielded to that sea of change
That was altering programming techniques
Since those long-gone days.
I want to think that he didn't.
In any case
I was impressed enough
To stop searching for
The annoying check,
By telling the Big Boss
That I cannot find it.
He was not surprised.
When I left the company
The Black-Jack game
Was still cheating,
If you touched the right switch.
I think this is how it should be.
I did not feel comfortable,
Editing the code of a Real Programmer.
This is one of the greatest
hacker epics, whatever form it might be in, blank verse, or otherwise. In a
few vivid images it clarifies more in the ethics and psychology of
hackers than a pile of research volumes, put together.
[1992 Note -- the author writes "The original
was not executed in the form of blank verse, and not even anything close to it --
ordinary prose, with non-justified paragraphs. During its travels across the net,
it turned into the 'blank verse', so popular nowadays. In other words,
it was 'hacked' on the net. One way or another, this looks fair."
The author adds that he himself likes this form better.]
Translation, (c) 2003, Vladislav Kugelevich.
See also: